package com.imchen.cms.cmscore.service;

import com.imchen.cms.cmscore.dao.LogMapper;
import com.imchen.cms.cmscore.model.Log;
import com.imchen.cms.utils.ServiceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @author imchen
 * @create: 2019-01-12 13:49
 **/
@Service
public class LogService implements BaseService<Log> {


    @Autowired
    private LogMapper mapper;

    @Override
    public HashMap<String, Integer> add(Log log) {
        int count= mapper.insertSelective(log);
        return ServiceUtil.toAddMap(count,log.getId());


    }

    @Override
    public Log findById(int id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int removeById(int id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int deleteById(int id) {
        return 0;
    }

    @Override
    public int update(Log log) {
        return mapper.updateByPrimaryKeySelective(log);

    }
}